<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE html>

<html>

<head>

<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>仪器共享</title>

<meta name="keywords" content="科研仪器，生命科学仪器，环境检测仪器，实验常用设备，分析仪器">

<meta name="description"
	content="中国领先的科研仪器共享平台，让您快速找到各种类型的科学研究仪器。提升闲置仪器利用率，产生更大科研价值。涵盖：生命科学仪器、环境检测仪器、实验常用设备、分析仪器、仪表、物性测试、测量/计量仪器、在线及过程控制仪器。

">
<!--<link rel="stylesheet" href="new_css/header_footer.css?t=1">-->
<link rel="stylesheet" href="new_css/publishService.css">
<link rel="stylesheet" href="css/new_style.css">
<link rel="stylesheet" href="css/reset.css">
<link rel="stylesheet" href="css/common.css">

<script src="new_js/jquery-1.11.3.js"></script>
<style>
.mainList .content .right .title {
	margin-left: 30px;
}

.main-content-mid {
	/*margin-left: 40px;*/
	
}

.mainList .content {
	width: 100%;
	overflow: hidden;
	height: 100% !important;
}

.mainList .content .right {
	height: min-830px !important;
	height: 100% !important;
	/* margin-bottom: 20px; */
	padding-bottom: 20px;
}

/*小箭头*/
.sun_item>.sun_item_div1:after, .sun_item>.sun_item_div1:before {
	border: solid transparent;
	content: '';
	height: 0;
	left: 100%;
	position: absolute;
	width: 0;
}

.sun_item>.sun_item_div1:before {
	border-width: 12px;
	border-left-color: rgba(196, 196, 196, 1);
	top: 75px;
}

.sun_item>.sun_item_div1:after {
	border-width: 10px;
	border-left-color: #fff;
	top: 77px;
}

/*goods-comm-stars style*/
.goods-comm {
	height: 41px;
	position: relative;
	z-index: 7;
}

.goods-comm-stars {
	line-height: 25px;
	height: 41px;
	position: absolute;
	top: 0px;
	left: 0;
	width: 400px;
}

.goods-comm-stars .star_l {
	float: left;
	display: inline-block;
	margin-right: 5px;
	display: inline;
}

.goods-comm-stars .star_choose {
	float: left;
	display: inline-block;
}
/* rater star */
.rater-star {
	position: relative;
	list-style: none;
	margin: 0;
	padding: 0;
	background-repeat: repeat-x;
	background-position: left top;
	float: left;
}

.rater-star-item, .rater-star-item-current, .rater-star-item-hover {
	position: absolute;
	top: 0;
	left: 0;
	background-repeat: repeat-x;
}

.rater-star-item {
	background-position: -100% -100%;
}

.rater-star-item-hover {
	background-position: 0 -48px;
	cursor: pointer;
}

.rater-star-item-current {
	background-position: 0 -48px;
	cursor: pointer;
}

.rater-star-item-current.rater-star-happy {
	background-position: 0 -25px;
}

.rater-star-item-hover.rater-star-happy {
	background-position: 0 -25px;
}

.rater-star-item-current.rater-star-full {
	background-position: 0 -72px;
}
/* popinfo */
.popinfo {
	display: none;
	position: absolute;
	top: 30px;
	background: url(images/infobox-bg.gif) no-repeat;
	padding-top: 8px;
	width: 192px;
	margin-left: -14px;
}

.popinfo .info-box {
	border: 1px solid #f00;
	border-top: 0;
	padding: 0 5px;
	color: #F60;
	background: #FFF;
}

.popinfo .info-box div {
	color: #333;
}

.rater-click-tips {
	font: 12px/25px;
	color: #333;
	margin-left: 10px;
	background: url(images/infobox-bg-l.gif) no-repeat 0 0;
	width: 151px;
	height: 34px;
	padding-left: 16px;
	overflow: hidden;
}

.rater-click-tips span {
	display: block;
	background: #FFF9DD url(images/infobox-bg-l-r.gif) no-repeat 100% 0;
	height: 34px;
	line-height: 34px;
	padding-right: 5px;
}

.rater-star-item-tips {
	background: url(images/star-tips.gif) no-repeat 0 0;
	height: 41px;
	overflow: hidden;
}

.cur.rater-star-item-tips {
	display: block;
}

.rater-star-result {
	color: #FF6600;
	font-weight: bold;
	padding-left: 10px;
	float: left;
}

/*评论*/
.commentary {
	width: 935px;
	height: 402px;
	border: 1px solid #C4C4C4;
}

.commentary .buyer-evaluation {
	width: 467px;
	border-right: 1px solid #d2d2d2;
}

.commentary .buyer-evaluation .buyer-evaluation-title {
	height: 41px;
	line-height: 41px;
	margin: 8px auto;
	text-align: center;

	/*border-bottom: 1px solid #d2d2d2;*/
}

.commentary .buyer-evaluation .buyer-evaluation-title p {
	padding-bottom: 8px;
	border-bottom: 1px solid #d2d2d2;
	color: #1A1A1A;
	font-size: 16px;
	/**/
}

.buyer-evaluation-content {
	margin: 20px 0 0px 20px;
	height: 300px;
	overflow: hidden;
	text-overflow: ellipsis;
}

.buyer-evaluation-content ul li span {
	color: #FF8A00;
}

.buyer-evaluation-time {
	text-align: right;
	margin-right: 20px;
}

.your-reply {
	border-right: 0px !important;
}

.commentary-btn {
	margin-right: 221px;
	margin-top: 30px;
}

a.clearfix.fr.commentary-btn {
	width: 151px;
	height: 46px;
	line-height: 46px;
	background-color: #ff8a00;
	text-align: center;
	color: #fff;
	font-size: 16px;
	float: left;
	margin-left: 155px;
	border-radius: 5px;
}

.mainList .content .right ul li label {
	width: 100px;
	display: inline-block;
	/*text-align: right;*/
	padding-right: 20px;
}

.mainList .content .right ul .item11 select {
	height: 54px;
	width: 477px;
}

.mainList .content .right ul .item4 textarea {
	width: 468px;
	height: 183px;
	vertical-align: middle;
}

.mainList .content .title {
	width: 100%;
	height: 47px;
	border-bottom: 1px solid #d3d3d3;
	line-height: 44px;
	font-size: 18px;
	color: #202020;
	margin: 20px auto;
}

.mainList .content .title span {
	display: inline-block;
	height: 100%;
	border-bottom: 2px solid #ff8a00;
}

.sun_item>.sun_item_div2 {
	display: inline-block;
	float: left;
	width: 989px;
	height: 172px;
	padding: 0 60px;
	border: none;
	border-bottom: 1px solid rgba(196, 196, 196, 1);
	border-left: 1px solid rgba(196, 196, 196, 1);
}

.biaodan {
	margin-left: 30px;
}

.sun_item>.sun_item_div2 {
	display: inline-block;
	float: left;
	width: 988px;
	height: 172px;
	padding: 0 60px;
	border: none;
	border-bottom: 1px solid rgba(196, 196, 196, 1);
	border-left: 1px solid rgba(196, 196, 196, 1);
}
</style>
<script>
		$(function() {
			$('#front_header .header_wrap .right').hover(function() {
				$('#front_header .header_wrap .right .main .icon img').attr('src', 'images/icon2.png');
				$('#front_header .header_wrap .right .out').show();
			}, function() {
				$('#front_header .header_wrap .right .main .icon img').attr('src', 'images/icon1.png');
				$('#front_header .header_wrap .right .out').hide();
			});
			$('#sorts').on('mouseover', 'li', function() {
				$(this).find('span img').attr('src', 'images/icon4.png');
			});
			$('#sorts').on('mouseout', 'li', function() {
				$(this).find('span img').attr('src', 'images/icon5.png');
			});
	
			$('.mainList .content .left li').click(function() {
				$(this).addClass('selected').siblings().removeClass('selected');
			});
		});
	</script>
</head>
<body style="background:#fff;">
	<!--header-->
	<%@include file="/header3.jsp"%>
	<div class="mainList">
		<div class="bNav">
			您的位置：首页 ><span id="top">全功能紫外-可见-近红外荧光光谱仪</span> > <span>仪器订单</span>
		</div>
		<div class="content">
			<div class="title">
				<span>仪器订单</span>
			</div>
			<div class="right">
				<div class="main-content-mid clearfix">
					<ul class="clearfix">
						<li class="sun_item clearfix">
							<div class="sun_item_div1">仪器信息</div>
							<div class="sun_item_div2">
								<div class="sun_item_img">
									<img id="0" src="images/productDetailPic.png" />
								</div>
								<div class="item_box">
									<br />
									<p id="1">高内涵筛选系统</p>
									<br />
									<p id="2">opertter</p>
									<br />
									<div class="goods-comm">
										<div class="goods-comm-stars">
											<span class="star_l">仪器综合评分：</span>
											<div id="readOnly"></div>
											<p id="scoreFenshu"></p>
										</div>
									</div>
								</div>
							</div>
						</li>
					</ul>
					<!--表单-->
					<div class="biaodan">
						<ul>
							<li><label>课题名称：</label> <input type="text" id="projectName"
								name="orderappli.appliCationProject"></li>
							<li class="item11"><label>仪器应用项目：</label> <select id="xz">
									<option data-appid="">请选择仪器应用项目</option>
							</select></li>
							<li><label>测试项目：</label> <input type="text"
								id="appliCationProject" name="orderappli.prinpical"></li>

							<li><label>联系人：</label> <input type="text" id="userName"
								name="orderappli.prinpical"></li>

							<li><label>联系电话：</label> <input type="text" id="userPhone"
								name="orderappli.pirnpicalTel"></li>
							<div id="add_div">
								<!-- <div class="row2" style="margin-left: 124px">
										<label></label>
										<input type="text"  style="width: 200px;">
										<img src="images/publishDemandReduce.png" style="vertical-align: middle">
									</div>
									<div class="row2" style="margin-left: 124px">
										<label></label>
										<input type="text"  style="width: 200px;">
										<img src="images/publishDemandReduce.png" style="vertical-align: middle">
									</div> -->
							</div>
							<li class="item8"><label>测试样品：</label> <input
								style="width: 31%" type="text" id="5" value=""> <img
								id="loop" src="images/publishDemandAdd.png"
								style="vertical-align: middle; margin-bottom: 5px;" /></li>
							<li class="item4"><label>备注：</label> <textarea
									name="Sample[0].remarks" id="remark"></textarea></li>
						</ul>
					</div>
					<a class="clearfix fr commentary-btn" onclick="submit();">提交</a>
				</div>
			</div>
		</div>
	</div>
	<!--footer-->
	<%@include file="/footer.jsp"%>
	<script src="js/common.js"></script>
	<script src="js/jquery.raty.js"></script>
	<script src="js/labs.js"></script>
	<script>
		$(document).ready(function(){
			insInfoRmation();
			getUserMessage();
			projectList();
			var valList = [];
			$('#loop').click(function(){
				var test = $('#5').val();
				var str = "";
				if(valList.indexOf(test) >=0){
					alert('不能选重复的!');
					return;
				}
				if(test == ''){
					alert("样品不能为空");
				}else{
					str += '<div class="row2" style="margin-left: 124px">\
								<input class="specimen" type="text" value="'+test+'" disabled="disabled" style="width: 200px;">\
								<img src="images/publishDemandReduce.png" style="vertical-align: middle" onclick="clickimg(this)">\
							</div>';
					$('#add_div').append(str);
					$('#5').val("");
					valList.push(test);
				}
			})
			
			clickimg=function(m){
				var index = $(m).parent('.row2').index();
				valList.splice(index, 1);
				m.parentElement.parentElement.removeChild(m.parentElement);
			}
		});
		
		function submit(){
			var sTime = document.cookie;
			var startTime = getCookie("startTime");
			var endTime = getCookie("endTime");
			var price = getCookie("computedPrice");
			var timeId = getCookie("timeId");
			var uId = $('#useridoflogin').val();
			console.log("价格：" + price)
			//var uId = '4d272484d5844be693c05443c4edd71e';
			if(uId == ''){
				alert('请登录后再进行此操作')
				return;
			}
			var specimen = [];
			var projectName = $('#projectName').val();
			if(projectName == ''){
				alert("课题名称不能为空")
				return;
			}
			var appliCationProject = "";
			var app1 = $('#appliCationProject').val();
			var app2 = $('#xz option:selected').attr("data-appid");
			if(app1 == '' && app2 == ''){
				alert("仪器应用项目与测试项目至少选填一个")
				return;
			}
			var remark = $('#remark').val();
			if(remark == ''){
				alert("备注内容不能为空")
				return;
			}
			var name = $('#userName').val();
			var phone = $('#userPhone').val();
			if($('#appliCationProject').val() != ''){
				appliCationProject = $('#appliCationProject').val();
			}else{
				appliCationProject = $('#xz option:selected').text();
			}
			for(var i = 0;i < $('.specimen').length;i++){
				specimen.push($('.specimen').eq(i).val());
			}
			if(specimen.length == 0){
				alert("至少填写一个测试样品")
				return;
			}
			$.ajax({
				//url:"http://localhost:8080/share_ins/app/exp/addOrder",
				url:Server + "/app/exp/addOrder",
				data:{
					specimen : specimen.join(),
					projectName : projectName,
					appliCationProject : appliCationProject,
					remark : remark,
					inId : ${param.id},
					uId : uId,
					name : name,
					phone : phone,
					startTime : startTime,
					endTime : endTime,
					price : price,
					timeId : timeId
				},
				type:"POST",
				dataType:"json",
				success : function(data){
					if(data == 1){
						alert("提交成功")
						$(location).attr("href","instrumentList11");
					}else if(data == 2){
						alert("订单信息提交失败")
					}else if(data == 3){
						alert("申请信息提交失败")
					}else if(data == 4){
						alert("样品信息提交失败")
					}else if(data == 5){
						alert("订单时间提交失败")
					}
				},
				error : function(msg){
					alert("提交失败")
				}
			})
		}
		
		function projectList(){
			$.ajax({
				//url:"http://localhost/equipment/InsInfo/projectList",
				url:Server + "/equipment/InsInfo/projectList",
				data:{
					iiId : ${param.id},
				},
				type:"POST",
				dataType:"json",
				success : function(data){
					var html = "";
					var pattren = '<option data-appid="#1">#0</option>';
					for(var i = 0;i<data.length;i++){
						var param = data[i];
						var item = '';
						item += pattren
							.replace("#0",param.projectName)
							.replace("#1",param.id),
						html += item;
					}
					var top = '<option data-appid="">请选择仪器应用项目</option>';
					html = top + html;
					$('#xz').html(html)
				}
			});
		}
		
		function getUserMessage(){
			var uId = $('#useridoflogin').val();
			//var uId = '4d272484d5844be693c05443c4edd71e';
			$.ajax({
				//url:"http://localhost/user/sum/getUser",
				url:Server + "/user/sum/getUser",
				data:{
					uId:uId,
				},
				type:"POST",
				dataType:"json",
				success : function(data){
					var realname = "";
					var mobile = "";
					if(data.realname != null){
						realname = data.realname;
					}
					if(data.mobile != null){
						mobile = data.mobile;
					}
					$('#userName').val(realname);
					$('#userPhone').val(mobile);
				}
			})
		}
		
						function getCookie(c_name) {
					if(document.cookie.length > 0) {
						c_start = document.cookie.indexOf(c_name + "=");//获取字符串的起点
						if(c_start != -1) {
							c_start = c_start + c_name.length + 1;//获取值的起点
							c_end = document.cookie.indexOf(";", c_start);//获取结尾处
							if(c_end == -1) c_end = document.cookie.length;//如果是最后一个，结尾就是cookie字符串的结尾
							return decodeURI(document.cookie.substring(c_start, c_end));//截取字符串返回
						}
					}
					return "";
				}
		
		
		function insInfoRmation(){
			$.ajax({
				//url:"http://localhost/equipment/InsInfo/insInfoRmation",
				url:Server + "/equipment/InsInfo/insInfoRmation",
				data :{
					id:${param.id},
				},
				type:"POST",
				dataType:"json",
				success : function(data){
					var avgScore = 0;
					var chineseName = "";
					var model = "";
					var infoSrc = "";
					if(data.chineseName != null){
						chineseName = data.chineseName;
					}
					if(data.insInfo != null){
						if(data.insInfo.infoSrc != null){
							infoSrc = data.insInfo.infoSrc;
						}
						if(data.insInfo.serial != null){
							model = data.insInfo.serial;
						}
					}
					if(data.comment[0] != null){
						if(data.comment[0].avgScore != null){
							avgScore = data.comment[0].avgScore;
						}
					}
					$('#0').attr("src",infoSrc);
					$('#1').text(chineseName);
					$('#2').text(model);
					$('#top').text(chineseName);
					$.fn.raty.defaults.path = 'images';
					$('#readOnly').raty({readOnly : true,score : avgScore});
				}
			});
		}
	</script>
	<script>
		$.fn.raty.defaults.path = 'images';
		$('#readOnly').raty({
			readOnly : true,
			score : 4.5
		});
	
		$(function() {
			$('#default').raty();
			$('#score').raty({
				score : 3
			});
			$('#score-callback').raty({
				score : function() {
					return $(this).attr('data-score');
				}
			});
			$('#scoreName').raty({
				scoreName : 'entity[score]'
			});
			$('#number').raty({
				number : 10
			});
			$('#number-callback').raty({
				number : function() {
					return $(this).attr('data-number');
				}
			});
			$('#numberMax').raty({
				numberMax : 5,
				number : 100
			});
			$('#starHalf').raty({
				half : true,
				path : null,
				starHalf : 'images/star-half-mono.png',
				starOff : 'images/star-off.png',
				starOn : 'images/stars-all.png'
			});
			$('#size').raty({
				path : 'images',
				cancel : true,
				cancelOff : 'cancel-off.png',
				cancelOn : 'cancel-on.png',
				half : true,
				starHalf : 'star-half.png',
				starOff : 'star-off.png',
				starOn : 'stars-all.png'
			});
			$('#target-div').raty({
				cancel : true,
				target : '#target-div-hint'
			});
			$('#target-text').raty({
				cancel : true,
				target : '#target-text-hint'
			});
			$('#target-textarea').raty({
				cancel : true,
				target : '#target-textarea-hint'
			});
			$('#target-select').raty({
				cancel : true,
				target : '#target-select-hint'
			});
			$('#targetType').raty({
				cancel : true,
				target : '#targetType-hint',
				targetType : 'score'
			});
			$('#targetKeep').raty({
				cancel : true,
				target : '#targetKeep-hint',
				targetKeep : true
			});
			$('#targetText').raty({
				target : '#targetText-hint',
				targetText : '--'
			});
			$('#targetFormat').raty({
				target : '#targetFormat-hint',
				targetFormat : 'Rating: {score}'
			});
			$('#targetScore').raty({
				targetScore : '#target-score'
			});
			$('#precision').raty({
				cancel : true,
				cancelOff : 'cancel-off.png',
				cancelOn : 'cancel-on.png',
				path : 'images',
				starHalf : 'star-half.png',
				starOff : 'star-off.png',
				starOn : 'stars-all.png',
				target : '#precision-hint',
				targetKeep : true,
	
				precision : true
			});
			$('#functions').raty({
				cancel : true,
				cancelOff : 'cancel-off.png',
				cancelOn : 'cancel-on.png',
				path : 'images',
				precision : true,
				starHalf : 'star-half.png',
				starOff : 'star-off.png',
				starOn : 'stars-all.png',
				target : '#functions-hint',
				targetKeep : true,
				click : function(score, evt) {
					alert('ID: ' + this.id + "\nscore: " + score + "\nevent: " + evt.type);
				},
				hints : [
					[ 'bad 1', 'bad 2', 'bad 3', 'bad 4', 'bad 5', 'bad 6', 'bad 7', 'bad 8', 'bad 9', 'bad' ],
					[ 'poor 1', 'poor 2', 'poor 3', 'poor 4', 'poor 5', 'poor 6', 'poor 7', 'poor 8', 'poor 9', 'poor' ],
					[ 'regular 1', 'regular 2', 'regular 3', 'regular 4', 'regular 5', 'regular 6', 'regular 7', 'regular 8', 'regular 9', 'regular' ],
					[ 'good 1', 'good 2', 'good 3', 'good 4', 'good 5', 'good 6', 'good 7', 'good 8', 'good 9', 'good' ],
					[ 'gorgeous 1', 'gorgeous 2', 'gorgeous 3', 'gorgeous 4', 'gorgeous 5', 'gorgeous 6', 'gorgeous 7', 'gorgeous 8', 'gorgeous 9', 'gorgeous' ]
				]
			});
	
			$('#score-function-run').on('click', function() {
				$('#functions').raty('score', $('#' + this.id.replace('-run', '')).val());
			});
	
			$('#click-function-run').on('click', function() {
				$('#functions').raty('click', $('#' + this.id.replace('-run', '')).val());
			});
	
			$('#readOnly-function-run').on('click', function() {
				var isReadOnly = $('#' + this.id.replace('-run', '')).val() === 'true';
	
				$('#functions').raty('readOnly', isReadOnly);
			});
	
			$('#cancel-function-run').on('click', function() {
				var isTrigger = $('#' + this.id.replace('-run', '')).val() === 'true';
	
				$('#functions').raty('cancel', isTrigger);
			});
	
			$('#reload-function-run').on('click', function() {
				$('#functions').raty('reload');
			});
	
			$('#get-score-function-run').on('click', function() {
				alert('score: ' + $('#functions').raty('score'));
			});
	
			$('#set-score-function-run').on('click', function() {
				$('#functions').raty('score', $('#' + this.id.replace('-run', '')).val());
			});
	
			$('#set-function-run').on('click', function() {
				var options = $('#' + this.id.replace('-run', '').val()),
					command = "$('#functions').raty('set', " + options + ");";
	
				eval(command);
			});
	
			$('#destroy-function-run').on('click', function() {
				$('#functions').raty('destroy');
			});
	
			$('#move-function-run').on('click', function() {
				$('#functions').raty('move', $('#' + this.id.replace('-run', '')).val());
			});
		});
	</script>
</body>
<style>
.sun_item>.sun_item_div1 {
	width: 22px;
	writing-mode: vertical-rl;
	writing-mode: tb-rl;
	height: 108px;
	display: inline-block;
	padding: 32px;
	position: relative;
	border-left: none !important;
	border-top: none !important;
	border-bottom: 1px solid rgba(196, 196, 196, 1);
	float: left;
	letter-spacing: 3px;
	text-align: center;
	font-size: 16px;
}

div#readOnly img {
	width: 24px;
	height: 25px;
}
</style>


</html>